package com.huijutao.fragment;

import android.widget.GridView;

import com.handmark.pulltorefresh.library.ILoadingLayout;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshGridView;
import com.huijutao.MyApp;

/**
 * Created by 兴盛 on 2015/4/24.
 */
public class RefreshSetting {
    public static void setPullDownAndUp(PullToRefreshGridView pgv){

        //设置刷新、加载方法
        pgv.setMode(PullToRefreshBase.Mode.BOTH);
        //获取加载代理
        //下拉刷新
        ILoadingLayout loadingLayoutProxy1 = pgv.getLoadingLayoutProxy(true, false);
        loadingLayoutProxy1.setPullLabel("继续下拉刷新");
        loadingLayoutProxy1.setReleaseLabel("放开刷新");
        loadingLayoutProxy1.setRefreshingLabel("正在努力刷新...");
        //上拉加载
        ILoadingLayout loadingLayoutProxy2 = pgv.getLoadingLayoutProxy(false, true);
        loadingLayoutProxy2.setPullLabel("继续下拉加载");
        loadingLayoutProxy2.setReleaseLabel("放开加载");
        loadingLayoutProxy2.setRefreshingLabel("正在努力加载...");
        GridView gv = pgv.getRefreshableView();
        //设置GridView的列数
        gv.setNumColumns(2);
        //设置间距
        gv.setVerticalSpacing(MyApp.dip2px(10));
        gv.setHorizontalSpacing(MyApp.dip2px(10));
    }
}
